package com.lucun.es_transaction.controller;

import com.lucun.es_transaction.config.RolePermission;
import com.lucun.es_transaction.entity.UserCommodity;
import com.lucun.es_transaction.service.UserCommService;
import com.lucun.es_transaction.util.AuthorityUtil;
import com.lucun.es_transaction.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/userComm")
public class UserCommController {
    @Autowired
    UserCommService userCommService;

    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/insert")
    public JsonResult<?> Insert(@RequestBody UserCommodity userCommodity, HttpServletRequest request) {
        return userCommService.index(userCommodity, request);
    }
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/delete")
    public JsonResult<?> Delete(int id, HttpServletRequest r) {
        return userCommService.delete(id, r);
    }
}
